<template>
	<view class="content">
		<!-- 地址 -->
		<view class="">
			<!-- 外卖 收货地址 -->
			<uni-order-shipping-address :address="address" v-if="isIndex === 0" :isShow="false"></uni-order-shipping-address>
			
			<!-- 到店 商家地址 -->
			<uni-order-shop-nav v-if="isIndex === 1" :isShow="false"></uni-order-shop-nav>
			
			<!-- 分割线 -->
			<uni-cut-off-rule></uni-cut-off-rule>
		</view>
		
		<!-- 间隔 -->
		<uni-interval></uni-interval>
		
		<view class="order-goods unify-background-color">
			<uni-order-goods :isTakeOut="isIndex" :affirmOrderMenu="affirmOrderMenu" :isOpenTakeOut="isOpenTakeOut" :carList="order.data.orderDetails" :total-price="order.data.amount"></uni-order-goods>
		</view>
		
		<!-- 间隔 -->
		<uni-interval></uni-interval>
		
		<!-- 订单信息 -->
		<view class="order-info unify-background-color unify-padding">
			<view class="order-item unify-flex unify-weight">
				<view class="order-item-left unify-flex">
					<view class="order-item-name">
						<view style="width: 100px;">订单信息</view>
					</view>
				</view>
			</view>
			<view class="order-item unify-flex" >
				<view class="order-item-left unify-flex">
					<view class="order-item-name unify-flex">
						<view>订单号</view>
					</view>
					
				</view>
				<view class="item-value-active">{{order.data.number}}</view>
			
			</view>
			<view class="order-item unify-flex" >
				<view class="order-item-left unify-flex">
					<view class="order-item-name unify-flex">
						<view>下单时间</view>
					</view>
	
				</view>
				<view class="item-value-active">{{order.data.orderTime}}</view>
			</view>
			<view class="order-item unify-flex">
				<view class="order-item-left unify-flex">
					<view class="order-item-name unify-flex">
						<view>实付</view>
					</view>
					
				</view>
				<view :class="5 === 5? 'unify-weight item-value tf-' + themeColor.name: 'item-value-active'">{{(5 === 5? moneySymbol:'') + (order.data.amount || '')}}</view>
			</view>
	
		</view>
		
		<!-- 间隔 -->
		<uni-interval height="60px"></uni-interval>
		
		<!-- 底部按钮 -->
		<uni-base-unify-btn title="立即支付"  v-if="order.data.status==1" @tap="toPay(order.data.id,order.data.amount)"></uni-base-unify-btn>
	</view>
</template>
 
<script>
	export default {
		data() {
			return {
				moneySymbol: this.$mConstDataConfig.moneySymbol,
				isIndex: 0,
				affirmOrderMenu: this.$mConstDataConfig.affirmOrderMenu,
				userOperationMenu: this.$mConstDataConfig.userOperationMenu,
				isOpenTakeOut: this.$mSettingConfig.isOpenTakeOut, // 是否开启外卖
				isOpenArrive: this.$mSettingConfig.isOpenArrive, // 是否开启到店
				order:null,
				address:
				{
					consignee:null,
					phone:null,
					detail:null
				}
			}
		},
		onLoad(options) {
			// console.log(options)
			// console.log(JSON.stringify(this.$parseURL(options)))
			this.order=this.$parseURL(options)
			const that =this
			that.address.consignee=that.order.data.consignee
			that.address.phone=that.order.data.phone
			that.address.detail=that.order.data.address
			console.log(that.address.detail)
		},
		methods:{
			toPay(id,amount){
				
				uni.navigateTo({
					url:'/pages/orderSuccess/orderSuccess?id='+id+'&amount='+amount
				})
			}
		}
		
	}
</script>

<style lang="scss" scoped>
	// 订单信息
	.order-info {
		
		.order-item:nth-child(1) {
			font-size: $uni-font-size-lg;
		}
		
		.order-item {
			height: 96rpx;
			align-items: center;
			justify-content: space-between;
			
			.order-item-name {
				width: 120rpx;
				justify-content: space-between;
			}
		}
	}
	
	.item-value {
		font-size: $uni-font-size-lg;
	}
	
	.item-value-active {
		opacity: .8;
	}
</style>